//
//  MoreGoodsDetailsCell.m
//  reSearchDemo
//
//  Created by 云库 on 15/9/30.
//  Copyright (c) 2015年 Kiwaro. All rights reserved.
//

#import "MoreGoodsDetailsCell.h"
#import "UIView+Category.h"
#import "UIImageView+WebCache.h"
#import "UIView+Layer.h"

@implementation MoreGoodsDetailsCell


- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        //图片
        self.imageView = [[UIImageView alloc]init];
        self.imageView.backgroundColor = [UIColor lightGrayColor];
        self.imageView.frame = CGRectMake(0, 0, self.width, self.width);
        [UIView SetRoundedCorners:self.imageView andcornerRadius:10.0 andborderWidth:1.0 andborderColor:[UIColor clearColor]];
        [self.contentView addSubview:self.imageView];
        
        //价格
        self.priceLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.height-30, self.width/2, 30)];
       // self.priceLabel.backgroundColor = [UIColor greenColor];
        self.priceLabel.font = [UIFont boldSystemFontOfSize:15];
        //self.priceLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.priceLabel];
        
        
        //销售数量
        self.saleNumLable = [[UILabel alloc]initWithFrame:CGRectMake(self.width/2, self.height-30, self.width/2, 30)];
        //self.saleNumLable.backgroundColor = [UIColor orangeColor];
        self.saleNumLable.font = [UIFont boldSystemFontOfSize:10];
        //self.saleNumLable.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.saleNumLable];
        
        //商品名字
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, self.imageView.height, self.width,self.height-self.imageView.height-self.priceLabel.height)];
        label.numberOfLines = 2;
        self.label = label;
        //label.backgroundColor = [UIColor redColor];
        label.font = [UIFont boldSystemFontOfSize:12];
        //label.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:label];
    }
    return self;
}


- (void)setGoods:(GoodsOtherBuy *)goods{
    _goods = goods;
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:goods.imgUrl] placeholderImage:[UIImage imageNamed:@"默认图片.png"]];
    self.label.text = goods.name;
    self.priceLabel.text = [NSString stringWithFormat:@"价格:%.2f",goods.salesMoney];
    self.saleNumLable.text = [NSString stringWithFormat:@"数量:%d",100];
}


@end
